import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-03-07
 * Time: 19:00
 */
public class main2 {
    public static int[] func(int[] array){
        int left = 0;
        int right = array.length - 1;
        while (left < right){
            while (left < right){
                if (array[left] % 2 != 0){
                    left++;
                }else {
                    break;
                }
            }
            while (left < right){
                if (array[right] % 2 == 0){
                    right--;
                }else {
                    break;
                }
            }
            int temp = array[left];
            array[left] = array[right];
            array[right] = temp;
        }
        return array;
    }
    public static void main(String[] args) {
        //调整数组顺序使得奇数位于偶数之前。调整之后，不关心大小顺序
        int[] array = {1,2,3,4,5,6};
        System.out.println(Arrays.toString(func(array)));
    }
}
